{% if debug %}
<html>
<head>
<style type="text/css">
	@import "/site_media/dojo/dojo/resources/dojo.css";
	@import "/site_media/dojo/dijit/themes/tundra/tundra.css";
</style>
<script type="text/javascript" src="/site_media/dojo/dojo/dojo.js"  djConfig = "parseOnLoad:true, isDebug:true"></script>
<script type="text/javascript" src="/site_media/js/serpantin.js"></script>
<script language="JavaScript" type="text/javascript">
	dojo.require("dojo.parser");
	dojo.require("dijit.layout.LayoutContainer");
	dojo.require("dijit.layout.ContentPane");
	dojo.require("dijit.layout.TabContainer");
	dojo.require("dijit.layout.SplitContainer");
	dojo.require("dijit.layout.AccordionContainer");
	dojo.require("dijit.form.ComboBox");
	dojo.require("dijit.form.Button");
	dojo.require("dijit.form.DateTextBox");
	dojo.require("dijit.form.FilteringSelect");

	dojo.require("dojox.data.QueryReadStore");

	dojo.provide("CustomQueryReadStore");
	dojo.declare("CustomQueryReadStore", dojox.data.QueryReadStore, {
		fetch:function(request) {
			request.serverQuery = {q:request.query.name};
			return this.inherited("fetch", arguments);
		}
	});
</script>
</head>
<body class="tundra">
{% endif %}

{% load i18n %}
<div class="Person">
<form id="fpform_{{ win_id }}" app="common" model="Person" oid="{{obj.id}}" class="fpform" method="POST">
<table>
<tr><td>
	<label for="id_lastname">Last name:</label></td><td>
	{{ form.lastname }}
	{% if form.lastname.errors %}
	*** {{ form.lastname.errors|join:", " }}
	{% endif %}
</td></tr>

<tr><td>
	<label for="id_firstname">First name:</label></td><td>
	{{ form.firstname }}
	{% if form.firstname.errors %}
	*** {{ form.firstname.errors|join:", " }}
	{% endif %}
</td></tr>

<tr><td>
	<label for="id_middlename">Middle name:</label></td><td>
	{{ form.middlename }}
	{% if form.middlename.errors %}
	*** {{ form.middlename.errors|join:", " }}
	{% endif %}
</td></tr>

<tr><td>
	<label for="id_town">City:</label>
    </td>
    <td>
	{{ form.town }}
    <!--
	<input dojoType="dijit.form.ComboBox" id="town" name="town" 
		mode="remote" 
		dataUrl="/json/common/Town/?search=%{searchString}"
		value="{{obj.town.name}}"
		selectedValue="{{obj.town.id}}" 
		style="width:200px;" 
		autoComplete="false">
	</input>  
    -->

 </td></tr>

<tr><td>
	<label for="id_phone2">Phones:</label></td><td>
	{{ form.phones }}
	{% if form.phones.errors %}
	*** {{ form.phones.errors|join:", " }}
	{% endif %}
</td></tr>

<tr><td>
	<label for="id_email">E-mail:</label></td><td>
	{{ form.email }}
	{% if form.email.errors %}
	*** {{ form.email.errors|join:", " }}
	{% endif %}
</td></tr>

<tr><td>
	<label for="id_web">Web site:</label></td><td>
	{{ form.web }}
	{% if form.web.errors %}
	*** {{ form.web.errors|join:", " }}
	{% endif %}
</td></tr>

<tr><td>
	<label for="id_im">Communicator:</label></td><td>
	{{ form.im }}
	{% if form.im.errors %}
	*** {{ form.im.errors|join:", " }}
	{% endif %}
</td></tr>

<tr><td>
	<label for="id_info">Info:</label></td><td>
	{{ form.info }}
	{% if form.info.errors %}
	*** {{ form.info.errors|join:", " }}
	{% endif %}
</td></tr>
<tr><td colspan="2">
<div class="box">
<button dojoType="dijit.form.Button"
	onclick="submitForm('common', 'Person', '{{ object_id }}', '{{ win_id }}', 'save');">
	<span>Save and continue</span></button>
<button dojoType="dijit.form.Button"
	onclick="this.setDisabled(true); submitForm('common', 'Person', '{{ object_id }}', '{{ win_id }}', 'save_and_close');">
	<span>Save</span>
</button>
</div>
</td></tr>

<!-- FIXME: get rid of those -->
<tr><td colspan="2">
<input type="hidden" name="createuser" value="1">
<input type="hidden" name="modifyuser" value="1">
{% if debug %}
<input type="submit">
{% endif %}
</td></tr>

</table> 
</form>

<p>{% if obj.createdate %}
		{% trans 'Createdata:' %} {{obj.createdate|date:"F j, Y"}}
		{{obj.createuser.username}}<br/>
    {% endif %}
    {% if obj.modifydate %}
		{% trans 'Modifydata:' %} {{obj.modifydate|date:"F j, Y"}}
		{{obj.modifyuser.username}}<br/>
    {% endif %}

</p><p>&nbsp;</p>
</div>

{% if debug %}
</body>
</html>
{% endif %}
